Insulin pump with closed-loop system